package com.guess.lolguessing.controller;


import com.guess.lolguessing.result.Result;
import com.guess.lolguessing.service.impl.UserGuessingServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.websocket.server.PathParam;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author author
 * @since 2024-10-24
 */
@RestController
@RequestMapping("/userguess")
@RequiredArgsConstructor
@CrossOrigin(origins = {"http://localhost:8080", "http://172.24.0.1:8080"}) // 允许来自该源的请求
public class UserGuessingController {
    private final UserGuessingServiceImpl userGuessingService;
    @GetMapping("/bet/{matchId}/{id}/{amount}")
    public Result bet(@PathVariable("matchId") Integer matchId,
                      @PathVariable("id") Integer teamId,
                      @PathVariable("amount") Integer betAmount) {
            return userGuessingService.bet(matchId, teamId, betAmount);
    }
}
